import Vue from "vue"
import VueRouter from "vue-router"
import HomeView from "../views/HomeView.vue"

Vue.use(VueRouter)

const routes = [
  {
    path: '/compass_detail',
    name: 'compass_detail',
    component: () => import('../views/CompassDetail.vue'),
    meta: {
      title: "指南详情 - 婚博会",
    },
  },
  {
    path: '/compass_more',
    name: 'Conpass_more',
    component: () => import('../views/CompassMore.vue'),
    meta: {
      title: "更多指南 - 婚博会",
    },
  },
  {
    path: "/login",
    name: "Login",
    meta: {
      title: "婚博会用户登录【婚礼纪】",
      hideHeader: true, //隐藏头
    },
    component: () => import("../views/Login.vue"),
  },
  {
    path: "/register",
    name: "Register",
    meta: {
      title: "婚博会用户注册【婚礼纪】",
      hideHeader: true, //隐藏头
    },
    component: () => import("../views/Register.vue"),
  },
  {
    path: "/search",
    name: "Search",
    meta: {
      title: "搜索结果 - 婚博会",
    },
    component: () => import("../views/SearchView.vue"),
    children: [
      {
        path: "search_all",
        meta: {
          title: "搜索结果 - 婚博会",
        },
        component: () => import("../views/SearchAll.vue"),
      },
      {
        path: "search_com",
        meta: {
          title: "搜索结果 - 婚博会",
        },
        component: () => import("../views/SearchCom.vue"),
      },
      {
        path: "search_pro",
        meta: {
          title: "搜索结果 - 婚博会",
        },
        component: () => import("../views/SearchPro.vue"),
      },
    ],
  },
  {
    path: "/workerMaster/:index",
    name: "workerMaster",
    meta: {
      title: "婚博会-司仪",
    },
    component: () => import("../views/WorkerMaster"),
    meta:{
      hideHeader:true,
    }
  },
  {
    path: "/workerHz/:index",
    name: "workerHz",
    meta: {
      title: "婚博会-跟妆",
    },
    component: () => import("../views/WorkerHz"),
  },
  {
    path: "/workerPhoto/:index",
    name: "workerPhoto",
    meta: {
      title: "婚博会-摄影",
    },
    component: () => import("../views/WorkerPhoto"),
  },
  {
    path: "/pro_details",
    name: "ProDetails",
    meta: {
      title: "套餐详情 - 婚博会",
    },
    component: () => import("../views/ProductDetails"),
  },
  {
    path: "/company",
    name: "Company",
    meta: {
      title: "婚庆公司详情 - 婚博会",
    },
    component: () => import("../views/CompanyView.vue"),
  },
  {
    path: "/",
    name: "home",
    meta: {
      title: "首页 - 婚博会",
    },
    component: HomeView,
  },
]

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
})

router.beforeEach((to, from, next) => {
  document.title = to.meta.title
  next()
})
export default router
